package com.xuan.temper.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;
import javax.xml.ws.Action;

/**
 * @创建人： king xuan
 * @创建时间：2020/9/16
 * @描述：
 */
@Configuration
@EnableScheduling
public class demo {

    @Autowired
    private MQProducer mqProducer;

    //@Scheduled(cron = "0/5 * * * * ?")
    public void testProducer() {
        for (int i = 0; i < 100; i++) {
            mqProducer.sendMessage("Hello RocketMQ " + i, "TopicTest",
                    "TagTest", "Key" + i);
        }

        try {
            Thread.sleep(10 * 1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
